﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/MasterPage.Master" Inherits="System.Web.Mvc.ViewPage<EM.Components.Entities.EM_Campaigns>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Create/Edit Campaign | Email Marketing
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            $('#StartDate').datepicker({ dateFormat: 'yy-mm-dd' });
            $('#EndDate').datepicker({ dateFormat: 'yy-mm-dd' });
        });
    </script>
    <h2>Step 1/3 - Create/Edit Campaign</h2>

    <% using (Html.BeginForm()) {%>
        <%: Html.ValidationSummary(true) %>
        
        <fieldset>
            <legend>Content</legend>
            
            <!-- Only for Edit-->
            <%if (Model != null && Model.CampaignID != null)
              { %>
            <div class="editor-label">
                <%: Html.HiddenFor(model => model.CampaignID)%>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.CampaignID, new{ @readonly=true})%>
                <%: Html.ValidationMessageFor(model => model.CampaignID)%>
            </div>
            <%} %>
            
            <div class="editor-label">
                <%: Html.LabelFor(model => model.CampaignName) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.CampaignName) %>
                <%: Html.ValidationMessageFor(model => model.CampaignName) %>
            </div>

            <div class="editor-label">
                <%: Html.LabelFor(model => model.StartDate) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.StartDate) %>
                <%: Html.ValidationMessageFor(model => model.StartDate) %>
            </div>
            
            <div class="editor-label">
                <%: Html.LabelFor(model => model.EndDate) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.EndDate) %>
                <%: Html.ValidationMessageFor(model => model.EndDate) %>
            </div>
            
            <div class="editor-label">
                <%: Html.LabelFor(model => model.CampaignDesc) %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.CampaignDesc) %>
                <%: Html.ValidationMessageFor(model => model.CampaignDesc) %>
            </div>
            
            <!--Change to read only-->
            <%if (Model != null && Model.CampaignID != null)
              { %>
             <div class="editor-label">
             Created By
             </div>
             <div class="editor-field">
                <%: Html.DisplayFor(model => model.CreatedBy)%>
            </div>

            <div class="editor-label">
                Created at
            </div>
            <div class="editor-field">
                <%: Html.DisplayFor(model => model.CreatedDate)%>
            </div>

            <div class="editor-field">
                <%: Html.HiddenFor(model => model.UpdatedBy)%>
            </div>

            <div class="editor-field">
                <%: Html.HiddenFor(model => model.UpdatedDate)%>
            </div>
            <% }%>

            <p>
                <button name="button" type="submit" value="SaveAndNext">Save & Next</button>
            </p>
        </fieldset>

    <% } %>

    <div>
        <%: Html.ActionLink("Back to List", "Index") %>
    </div>

</asp:Content>

